﻿using ShevaEngine.Core.Interfaces;
using ShevaEngine.Core.Modules.Scenes;

namespace ShevaEngine.Core.GameLogic.Triggers
{
    /// <summary>
    /// Collision trigger.
    /// </summary>
    public abstract class CollisionTrigger : Trigger
    {
        /// <summary>On enter event.</summary>
        public event OnTriggerEventCallback OnEnter;
        /// <summary>On leaved event.</summary>
        public event OnTriggerEventCallback OnLeaved;

        /// <summary>
        /// Attachable object.
        /// </summary>
        /// <param name="attachAbleObject"></param>
        public CollisionTrigger()
            : base()
        {            
        }

        /// <summary>
        /// Trigger entered.
        /// </summary>
        /// <param name="collisionTrigger"></param>
        public void TriggerEntered(object sender, TriggerEventArgs e)
        {
            if (this.OnEnter != null)
                this.OnEnter(sender, e);
        }

        /// <summary>
        /// Trigger leaved.
        /// </summary>
        /// <param name="collisionTrigger"></param>
        public void TriggerLeaved(object sender, TriggerEventArgs e)
        {
            if (this.OnLeaved != null)
                this.OnLeaved(sender, e);
        }
    }
}
